/*
 * @Author: DUST
 * @Date: 2023-06-28 09:12:41
 * @LastEditors: DUST
 * @LastEditTime: 2023-06-28 09:18:09
 * @FilePath: \koa-node-ts\app\model\Website.ts
 * @Description: 
 * undefined
 */
import { Column, DataType, Model, Table } from "sequelize-typescript"

@Table({
  tableName: "Website",
  timestamps: true, // 自动维护时间
  freezeTableName: true, // 禁止修改表名，如果不写会把表名自动复数化，users
  paranoid: false, // 软删除
  indexes: [{ unique: true, fields: ["id"] }],
})
export default class Website extends Model<Website> {
  @Column({
    type: DataType.INTEGER.UNSIGNED,
    autoIncrement: true,
    primaryKey: true,
    allowNull: false,
    comment: "用户id",
  })
  id!: number;

  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "网站名称",
  })
  name!: string;

  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "网站地址",
  })
  url!: string;

  @Column({
    type: new DataType.STRING(256),
    comment: "网站描述",
  })
  description!: string;

  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "网站logo地址",
  })
  logoUrl!: string;

  @Column({
    type: new DataType.INTEGER({ length: 8 }),
    allowNull: false,
    comment: "网站类型",
  })
  type!: number;
}
